// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the EEGANALYSIS_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// EEGANALYSIS_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef EEGANALYSIS_EXPORTS
#define EEGANALYSIS_API __declspec(dllexport)
#else
#define EEGANALYSIS_API __declspec(dllimport)
#endif



EEGANALYSIS_API int fnEEGAnalysis(void);//just for test

//error handling functions
/*
Functinality:
	(unicode) set the handler of error-handling function, 
		the dll has an internal default function which display a messagebox
Parameters:
	h	pointer to the handler
*/
EEGANALYSIS_API void EH_SetErrorHandlerW( void (*h)(const wchar_t *what));


//-----------------------------

//dll life cycle

//should always be the first invoked function
EEGANALYSIS_API void DLL_Init();

//should always be the last invoked function
EEGANALYSIS_API void DLL_Finish();
//-----------------------------

//function for data manipulation

//Add a channel to data store, should be invoke before DS_AddData()
EEGANALYSIS_API void DS_AddChannel(unsigned int  eid, unsigned int reserveSize = 0);

//should be invoke after adding data
EEGANALYSIS_API unsigned int DS_EndChannel(void);

//Add a double to the current channel
EEGANALYSIS_API void DS_AddSingleData(double x);

//**COPY** an array of double, last is the pointer to the one after the last double, 
EEGANALYSIS_API void DS_AddData(double *first, double *last);

//Clean all data 
EEGANALYSIS_API void DS_CleanAll(void);

//Set the SamplingRate of the data being import
EEGANALYSIS_API void DS_SetSamplingRate(unsigned long sr);

//Set the displayable name of the current channel
EEGANALYSIS_API void DS_SetChannelNameW(wchar_t name);

//Set the position of an electrode related to the current channel or to the specified channel with electrodeID
EEGANALYSIS_API void DS_SetElectrodePos(double x, double y, int electrodeID=-1);

//Set the reference type, the default is NONE
EEGANALYSIS_API void DS_SetRef(int type);
//-----------------------------------


//FFT graph functions

/*
Name: FFT_SetParameters
Functinality:
	specify the FFT parameters
Parameters:
	@eids		the pointer to a int array, indicating the channel involved in the next calculation of FFT
	@ch_count	the size of eids array
	@startpt, endpt		index of start point and end point, related to the first point in dataStore
*/
EEGANALYSIS_API void FFT_SetParameters(int *eids, unsigned int ch_count, unsigned int startpt, unsigned int endpt);
EEGANALYSIS_API bool FFT_StartCalc();

//display the diagram
EEGANALYSIS_API int FFT_ShowFFTGraph();
//-----------------------------------

//DSA graph functions
EEGANALYSIS_API void DSA_SetOnceParameters( int *eids, unsigned int count, unsigned int startpt, unsigned int endpt);
EEGANALYSIS_API int  DSA_StartCalc();	//return the index in out, resultID

EEGANALYSIS_API int  DSA_AddViewW( int resultID, wchar_t *title);
EEGANALYSIS_API int  DSA_ShowDSAGraph();

//-----------------------------------

//Map graph functions
//EEGANALYSIS_API void 
EEGANALYSIS_API int  MAP_ShowMAPGraph();
EEGANALYSIS_API void  MAP_SetDefaultParameters( int *eids, unsigned int count, int type,unsigned int midPt);//type is an enumuation actually
//-----------------------------------